<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>innerHTML innerText</title>
		<script>
			function chnageDiv(){
				var d=document.getElementById("d1");
				alert(d.innerHTML);
				alert(d.innerText);
				//d.innerHTML="<h2 style='color:red;'>教育改变生活</h2>";
				d.innerText="<h2 style='color:red;'>教育改变生活</h2>";
			}
			function gotInput(){
				var str="";
				var ar=document.getElementsByName("season");
				for(var i=0;i<ar.length;i++){
					str+=ar[i].value+"  ";
				}
				///document.getElementById("d4").innerHTML=str;
				document.querySelector(".ccc").innerHTML=str;
			}
		</script>
	</head>
	<body>
		<div id="d1"><span>We change lives</span></div>
		<div id="d2">
			<input type="text" name="season"  placeholder="输入季节名称" />
			<input type="text" name="season" placeholder="输入季节名称"  />
			<input type="text" name="season"  placeholder="输入季节名称" />
			<input type="text" name="season"  placeholder="输入季节名称" />
		</div>
		<input type="button" value="改变div内容" onclick="chnageDiv()"/>
		<input type="button" value="获得文本框内容" onclick="gotInput()"/>
		<div style="border:2px solid red" id="d4" class="ccc"></div>
	</body>
</html>
